﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.DataTransfer;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.win2dEffectControl.DataClass;
using 纸片人.CalculateControls;
// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public sealed class OpacityEffectControl : EffectControl
    {
         

        private TextBoxSlider opacitySlider;

        private OpacityEffectData opacityEffectData;
        public OpacityEffectControl()
        {
           
            this.DefaultStyleKey = typeof(OpacityEffectControl);
            OneEffetData= opacityEffectData = new OpacityEffectData();
        }

        public override EffectOneSourceData OneEffetData { get; set; }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            SetEffectName("透明效果", "OpacityEffect");
            opacitySlider = GetTemplateChildFormName<TextBoxSlider>(nameof(opacitySlider));
            CreateBinding(opacityEffectData, "", new PropertyPath(nameof(OpacityEffectData.Opacity)), BindingMode.TwoWay, opacitySlider, TextBoxSlider.ValueProperty);
        }

    }
}
